#include "DXUT.h"

#ifndef UIBASE_H
#define UIBASE_H

#include <map>
#include <vector>
#include <algorithm> 

#include "../Helper.h"

struct UIVertex {
	D3DXVECTOR3 Position;
	D3DXVECTOR2 Texture;
};

struct UIElement {
	RECT		m_Position;
	byte		m_Texture;
	D3DXVECTOR2 m_UVmin;
	D3DXVECTOR2 m_UVmax;
	D3DXVECTOR3 m_Blendcolor;
};

struct DrawCall {
	UIVertex * Vertices;
	UINT	   Size;
	BYTE	   Texture;
};

class UIBaseElement {
private:
	ID3D11ShaderResourceView*	m_Texture;
	RECT						m_Position;
	ID3DX11Effect*				m_pEffect;
	ID3D11InputLayout*			m_IL;
	ID3D11Buffer*				m_VB;
public:
	 UIBaseElement();
	~UIBaseElement();

	void OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime, float fElapsedTime );

	void OnD3D11CreateDevice( ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc );
	void OnD3D11DestroyDevice( );

	void OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc );
	void OnD3D11ReleasingSwapChain( );

	void handleMouse( bool bLeftButtonDown, bool bRightButtonDown, bool bMiddleButtonDown, bool bSideButton1Down, bool bSideButton2Down, int nMouseWheelDelta, int xPos, int yPos );
	void handleKeyboard( UINT nChar, bool bKeyDown, bool bAltDown );
};

#endif